package com.app.service.impl;


import com.app.mapper.AreaBaseMapper;
import com.app.mapper.ConfigMapper;
import com.app.model.AreaBaseModel;
import com.app.model.BrowseNumberModel;
import com.app.model.ConfigModel;
import com.app.service.AreaBaseService;
import com.app.service.ConfigService;
import com.app.util.StringTool;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @Description:地区孵化基地
 * @Author: N
 * @Date: 2022年11月24日 10点29分
 */
@Service
public class AreaBaseServiceImpl implements AreaBaseService {

    @Autowired
    AreaBaseMapper areaBaseMapper;

    @Override
    public int insert(AreaBaseModel model) {
        return areaBaseMapper.insert(model);
    }

    @Override
    public void update(AreaBaseModel model) {
        areaBaseMapper.updateById(model);
    }

    @Override
    public void delete(Integer id) {
        areaBaseMapper.deleteById(id);
    }

    @Override
    public List<AreaBaseModel> getListByModel(AreaBaseModel model) {
        QueryWrapper<AreaBaseModel> queryWrapper = new QueryWrapper<>();
        if(StringTool.isNotEmpty(model.getBaseName()))
        {
            queryWrapper.eq("base_name",model.getBaseName());
        }
        return areaBaseMapper.selectList(queryWrapper);
    }

    @Override
    public AreaBaseModel getModelById(Integer id) {
        return areaBaseMapper.selectById(id);
    }
}
